import { ref,onMounted } from 'vue';
import { useRoute } from 'vue-router'
import router from '@/router/index'
import { info ,postuserbanner} from '@/api/api'
import useZBStore from '@/pinia'



//轮播图
export function useMySwipe(){
const route = useRoute()
const useName = ref('用户2333')
const UseImgsrc = ref("")
let Listbanner = ref([])
//   Listbanner.value=[{
//     "img":"@/assets/img/景.png"
//   },
// {
//     "img":"@/assets/img/背.png"
//   },
// {
//     "img":"@/assets/img/背景.png"
//   }]
UseImgsrc.value = 'https://img.xiaopiu.com/userImages/img306164da746310.jpg'
onMounted(async () => {
//   console.log(localStorage.getItem('userId'));
  let {status,data:{toux,username}} = await info({id:localStorage.getItem('userId')})
  
 UseImgsrc.value = toux  


 console.log(UseImgsrc.value);
 

//   UseImgsrc.value =  toux
  useName.value =   username
   
//   UseImgsrc.value =    localStorage.getItem('useImg')

})
onMounted(async () => {
 let {data} = await postuserbanner({userid:22})
       Listbanner.value = data
      //  console.log(res );
// //   UseImgsrc.value =    localStorage.getItem('useImg')

})
// import useZBStore from '@/pinia'
// const store = useZBStore()
const removeItem =() =>{
    localStorage.removeItem("token"),
     localStorage.removeItem("userId"),
     localStorage.removeItem("useImg"),
     localStorage.removeItem("uId"),
     localStorage.removeItem("userName"),
     router.replace('login')
}
 
  return{
useName,UseImgsrc,Listbanner, removeItem
  }
}
  // <!-- 主题部分 -->
export function useMyTheme(){
  // <!-- 主题部分 -->
let Lists = ref([
    {name:'收藏',icon:'star'},
    {name:'评价',icon:'chat'},
    {name:'浏览',icon:'underway'},
    {name:'钱包',icon:'balance-list'},
    {name:'红包/卡卷',icon:'vip-card'},
    {name:'余额',icon:'medal'},
])
    return{
    Lists,
    }
}
//   底部tab栏
export function useMyTab(){
  const route = useRoute()
//   底部tab栏
 const active = ref('nearby');
    return{
    active,
    route
    }
}